<%@ page language="java" import="java.util.*" pageEncoding="utf8" %>

<%@ page import="com.niit.bc.bean.*" %>
<%@ page import="com.niit.bc.util.web.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%
    if (request.getAttribute("msg") != null) {
        Object obj = request.getAttribute("msg");
        System.out.println("obj=" + obj.toString());
        out.println("<script language=\"javascript\">alert('" + request.getAttribute("msg").toString() + "')</script>");
    }
%>
<div class="right">
    <div class="right1">
        <h3>
            <form class="keywordform" action="SearchBook" method="post">
                <img src="images/icon_search.gif" align="absmiddle"/><strong>我要找图书：</strong>
                <input class="kw" id="key" name="key" value="请输入要查找的书名"
                       onfocus="if(this.value=='请输入要查找的书名'){this.value='';}">
                <input class="fcsearch" type="submit" value="查找">
            </form>
        </h3>
    </div>
    <div class="clear"></div>


    <div class="clear"></div>

    <div class="shoplisting">
        <ul>
            <%
                List <BookBean> bookList = null;
                BookBean book = null;
                if (request.getAttribute("list") != null) {
                    bookList = (List <BookBean>) request.getAttribute("list");
                    if (bookList != null && bookList.size() != 0) {
                        for (int i = 0; i < bookList.size(); i++) {
                            book = bookList.get(i);
            %>
            <li onMouseOver="this.className='property2_hover'" onMouseOut="this.className='property2'">
                <div class="photo"><a href="ShowBook?bookId=<%=book.getBookId() %>" target="_blank"
                                      title="<%=book.getBookName()%>"><img alt="<%=book.getBookName()%>"
                                                                           src="<%=book.getBookPhoto()%>"></a></div>
                <div class="details">
                    <h3>￥<%=book.getBookPrice()%>元</h3>
                    <h4 align="center"><a title="<%=book.getBookName()%>" href="ShowBook?bookId=<%=book.getBookId() %>"
                                          target=_blank><%=book.getBookName() %>
                    </a></h4>
                </div>
            </li>
            <%
                    }
                }
            } else {
            %>
            <ul>
                <li>温馨提示：</li>
                <li>没有查询到相关图书，请查阅其它图书。</li>
            </ul>
            <%} %>
        </ul>
    </div>
    <div class="multipage">
        <div id='fenye' class='fenye'>
            <table border="0" align="right">
                <c:if test="${pageUtil != null }">
                    <tr>
                        <td>
                            共${pageUtil.pageCount}页&nbsp;&nbsp;&nbsp;共${pageUtil.rowCount}条记录&nbsp;&nbsp;&nbsp;第${pageUtil.pageCurr}页&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                        <td>
                            <c:if test="${pageUtil.pageCurr == 1 }">
                                首页 上一页
                            </c:if>
                            <c:if test="${pageUtil.pageCurr != 1 }">
                                <a href="BookList?pageCount=${pageUtil.pageCount}&pageCurr=1&rowCount=${pageUtil.rowCount}"
                                   class="prev">首 页</a> <a
                                    href="BookList?pageCount=${pageUtil.pageCount}&pageCurr=${pageUtil.pageCurr-1}&rowCount=${pageUtil.rowCount}"
                                    class="prev">上一页</a>
                            </c:if>
                            <c:if test="${pageUtil.pageCurr >= pageUtil.pageCount} ">
                                下一页 末页
                            </c:if>
                            <c:if test="${pageUtil.pageCurr != pageUtil.pageCount} ">
                                <a href="BookList?pageCount=${pageUtil.pageCount}&pageCurr=${pageUtil.pageCurr+1}&rowCount=${pageUtil.rowCount}"
                                   class="prev">下一页</a><a
                                    href="BookList?pageCount=${pageUtil.pageCount} &pageCurr=${pageUtil.pageCurr}&rowCount=${pageUtil.rowCount}"
                                    class="prev">末页</a>
                            </c:if>
                        </td>

                    </tr>
                </c:if>
            </table>
        </div>
    </div>

</div>

<div class="clear"></div>